package com.ht.system.controller;

import java.util.Date;
import java.util.List;
import java.io.IOException;
import com.ht.common.core.web.domain.AjaxResult;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ht.common.log.annotation.Log;
import com.ht.common.security.utils.SecurityUtils;
import com.ht.common.core.utils.SnowflakeIdWorker;
import com.ht.common.log.enums.BusinessType;
import com.ht.common.security.annotation.RequiresPermissions;
import com.ht.system.domain.EnterpriseOper;
import com.ht.system.service.IEnterpriseOperService;
import com.ht.common.core.web.controller.BaseController;
import com.ht.common.core.web.domain.AjaxResult;
import com.ht.common.core.utils.poi.ExcelUtil;
import com.ht.common.security.utils.SecurityUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import com.ht.common.core.web.page.TableDataInfo;

/**
 * 企业操作员Controller
 *
 * @author zmx
 * @date 2025-03-22
 */
@Api(tags = "企业操作员接口")
@RestController
@RequestMapping("/enterpriseOper")
public class EnterpriseOperController extends BaseController {
	@Autowired
	private IEnterpriseOperService enterpriseOperService;

	/**
	 * 查询企业操作员列表
	 */
	@ApiOperation("列表,权限:system:enterpriseOper:list")
	@RequiresPermissions("system:enterpriseOper:list")
	@GetMapping("/list")
	public TableDataInfo list(EnterpriseOper enterpriseOper) {
		startPage();
		List<EnterpriseOper> list = enterpriseOperService.selectEnterpriseOperList(enterpriseOper);
		return getDataTable(list);
	}

	/**
	 * 获取企业操作员详细信息
	 */
	@ApiOperation("详细信息,权限:system:enterpriseOper:list")
	@RequiresPermissions("system:enterpriseOper:list")
	@GetMapping(value = "/getInfo/{id}")
	public AjaxResult getInfo(@PathVariable("id") String id) {
		return AjaxResult.success(enterpriseOperService.selectEnterpriseOperById(id));
	}



	/**
	 * 修改企业操作员
	 */
	@ApiOperation("修改,权限:system:enterpriseOper:edit")
	@RequiresPermissions("system:enterpriseOper:edit")
	@Log(title = "企业操作员", businessType = BusinessType.UPDATE)
	@PostMapping("edit")
	public AjaxResult edit(@RequestBody EnterpriseOper enterpriseOper) {
		enterpriseOper.setUpdateTime(new Date());
		enterpriseOper.setUpdateBy(SecurityUtils.getNickName());
		return toAjax(enterpriseOperService.updateEnterpriseOper(enterpriseOper));
	}

	/**
	 * 删除企业操作员
	 */
	@ApiOperation("删除,权限:system:enterpriseOper:remove")
	@RequiresPermissions("system:enterpriseOper:remove")
	@Log(title = "企业操作员", businessType = BusinessType.DELETE)
	@GetMapping("remove/{ids}")
	public AjaxResult remove(@PathVariable("ids") String[] ids) {
		return toAjax(enterpriseOperService.deleteEnterpriseOperByIds(ids));
	}
}
